class MahjongCheckResult {
    constructor() {
        // this.playerTablePosition = 0;
        this.uid = 0;
        this.operation = 0;
        this.targetCard = 0;
        this.chuPlayer = null;
        this.gangOpPlayer = null;
        this.tingList = [];
        this.gangList = [];
        // this.fanResult = 0;
    }

    // addFanResult(fanType) {
    //     this.fanResult = this.fanResult | fanType;
    // }

    hasGangAndSetOperation(card) {
        for(let gang of this.gangList) {
            if(gang.cards[0] === card) {
                this.operation |= gang.type;
                this.targetCard = card;
                return true;
            }
        }
        return false;
    }

    toString() {
        let chuPlayerUid = this.chuPlayer == null ? null : this.chuPlayer.getUid();
        let gangOpPlayerUid = this.gangOpPlayer == null ? null : this.gangOpPlayer.getUid();
        return `uid: ${this.uid}, operation: ${this.operation}, targetCard: ${this.targetCard}, chuPlayerUid: ${chuPlayerUid}, 
                gangOpPlayerUid: ${gangOpPlayerUid}, tingList: ${this.tingList}, gangList: ${JSON.stringify(this.gangList)}`;
    }
}
module.exports = MahjongCheckResult;
